/* -----------------------------------------------------------------------------
 * PROJECT    : lwf_common
 * FILE       : CollectionUtils.java
 *
 * HISTORY:
 * Date          Author                        Description
 * ----------------------------------------------------------------------------- 
 * Mar 29, 2012  MyCodeTalks			       Created
 */

package net.lwf.collection;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CollectionUtils {
	
	public static Map<String, String> toMap(List<String> data) {
		Map<String, String> map_converted = null;
		if(data != null && data.size() != 0) {
			map_converted = new HashMap<String, String>();
			for(String value: data) {
				map_converted.put(value, value);
			}
		}
		return map_converted;
	}
	
	public static List<String> toListByKeys(Map<String, String> data) {
		List<String> lst_converted = null;
		if(data != null && !data.isEmpty()) {
			lst_converted = new ArrayList<String>(data.keySet());
		}
		return lst_converted;
	}
	
	public static List<String> toListByValuess(Map<String, String> data) {
		List<String> lst_converted = null;
		if(data != null && !data.isEmpty()) {
			lst_converted = new ArrayList<String>(data.values());
		}
		return lst_converted;
	}

}
